package com.zy.common.enums;

public enum TaskType {
    BUG(1, "缺陷修复"),
    DEMAND(2, "需求开发"),
    OTHER(3, "其他事务");

    private final int code;
    private final String desc;

    TaskType(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /** 通过 code 获取枚举 */
    public static TaskType fromCode(int code) {
        for (TaskType t : values()) {
            if (t.code == code) {
                return t;
            }
        }
        throw new IllegalArgumentException("未知任务类型 code=" + code);
    }
}
